package com.butang.service;

import com.butang.AOP.Log;
import com.butang.mapper.DeptMapper;
import com.butang.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * ClassName: DeptServiceImpl
 * Package: com.butang.service
 * Description:
 *
 * @Author BuTang
 * @Create 2023/7/9 23:07
 * @Version 1.0
 */
@Service
public class DeptServiceImpl implements DeptService{
    @Autowired
    private DeptMapper deptMapper;

    @Override
    public List<Dept> list() {
        List<Dept> list = deptMapper.list();
        return list;
    }
    @Log
    @Override
    public void delete(Integer id) {
        deptMapper.delete(id);
    }

    @Log
    @Override
    public void insert(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.insert(dept);
    }

    @Override
    public Dept idSelect(Integer id) {
        Dept dept = deptMapper.idSelect(id);
        return dept;
    }
    @Log
    @Override
    public void update(Dept dept) {
        deptMapper.update(dept);
    }
}
